<table class="tborder" cellspacing="1" cellpadding="4" border="0" style="clear: both">
    <tbody>

        <tr>
            <td class="thead" colspan="2">
                <div style="float: right;">
                    <span class="smalltext"><strong>Texte au cas où</strong></span>
                </div>
                <div>
                    <strong><?php echo $topic->subject; ?></strong>
                </div>
            </td>
        </tr>
        <tr>
            <td class="tcat" width="15%"><span class="smalltext"><strong>Author</strong></span></td>
            <td class="tcat" width="85%"><span class="smalltext"><strong>Message</strong></span></td>
        </tr>
<?php
// Check if a post at least exists
if(isset($posts) && !empty($posts)) {

    foreach ($posts as $post)
    {
    ?>
        <tr>
        <td class="trow1" width="15%" valign="top" style="white-space: nowrap;" text-align="center">
            <strong><?php echo $post->poster; ?></strong>
            <br />
            <span class="smalltext">
                Administrateur
                <br />
                Img
                <br />
                <br />
                Date d'inscription : 19-04-2010
                <br />
                Messages : 13
            </span>
        </td>
        <td class="trow1 post" width="85%" valign="top">
                <div class="postAnchor">
                    <span class="smalltext">
                        <strong><a href="<?php echo __route('ml-forum/topics/show&t='.$topic->id.'#pid'.$post->id); ?>">#</a></strong>
                    </span>
                </div>
                <div>
                    <a name="pid<?php echo $post->id ; ?>"></a><?php echo $post->message ; ?>
                </div>
                <?php if( $post->poster_id === MSession::getInstance()->getUserID() ) { ?>
                    <div class="actionsOnPost">
                        <a href="#"><span class="postModify" id="postModify">Modify</span></a> | <a href="#"><span class="postDelete">Delete</span></a>
                    </div>
                <?php } ?>
        </td>
    </tr>

    <?php
    } // end foreach
} // end if
else
{
?>

    <tr>
        <td class="trow1" colspan="5" valign="top" style="white-space: nowrap;" text-align="center;">
            <div align="center"><?php echo __t('mandrill.forum.posts.empty', array(), 'ml-forum', 'modules'); ?></div>
        </td>
    </tr>

<?php
} // end else
?>
        </tbody>
</table>
<br />

<div style="display: none">
    <div class="hidden"></div>
</div>


<?php
// User is logged ?
if(MSession::getInstance()->isLogged()) {
    echo __tag('a', array(
                            'class'=>'button',
                            'href'=>__route('ml-forum/topics/reply&t='.$topic->id)),
                            __t('mandrill.forum.topic.reply',NULL));
}
?>

<div style="display: none">
    <div id="hidden"></div>
</div>

<script>
    /* Make the request and render into the hidden div */
    $("#postModify").live('click', function() {
        $.ajax({
            url:"<?php echo __route('ml-forum/topics/modify');?>",
            type:"POST",
            data:'&message=e&topic=' + <?php echo $_GET['t']; ?>,
            success:function(result){
                $('#hidden').html(result);
            }
        });
    });

    /* Show the colorbox */
    $("#postModify").colorbox({
                                width:"90%",
                                height:"90%",
                                inline:true,
                                href:"#hidden",
                                onComplete:function(){
                                    $('#modifyTextarea').cleditor({width: '85%'});
                                }
                            });
</script>

<br />
<br />